from django.db import models
from utils.model import BaseModel
# Create your models here.

class Banner(BaseModel):
    title = models.CharField(max_length=64,verbose_name="标题")
    link = models.CharField(max_length=64,verbose_name="链接")
    #upload_to对应的存放路径是在settings中的MEDIA_URL相关配置,blank为非必填的意思
    image = models.ImageField(upload_to="banner",verbose_name="图片",blank=True)

    class Meta:
        db_table ="my_banner"
        verbose_name_plural = "轮播图"

    def __str__(self):
        #返回描述信息
        return self.title